﻿using System.Collections.Generic;

namespace com.binance.client.model.enums
{

	public sealed class MarginTransferType
	{
		public static readonly MarginTransferType IN = new MarginTransferType("IN", InnerEnum.IN, "1");
		public static readonly MarginTransferType OUT = new MarginTransferType("OUT", InnerEnum.OUT, "2");

		private static readonly IList<MarginTransferType> valueList = new List<MarginTransferType>();

		static MarginTransferType()
		{
			valueList.Add(IN);
			valueList.Add(OUT);
		}

		public enum InnerEnum
		{
			IN,
			OUT
		}

		public readonly InnerEnum innerEnumValue;
		private readonly string nameValue;
		private readonly int ordinalValue;
		private static int nextOrdinal = 0;

		private readonly string code;

		internal MarginTransferType(string name, InnerEnum innerEnum, string code)
		{
			this.code = code;

			nameValue = name;
			ordinalValue = nextOrdinal++;
			innerEnumValue = innerEnum;
		}

		public override string ToString()
		{
			return code;
		}

		public static IList<MarginTransferType> values()
		{
			return valueList;
		}

		public int ordinal()
		{
			return ordinalValue;
		}

		public static MarginTransferType valueOf(string name)
		{
			foreach (MarginTransferType enumInstance in MarginTransferType.valueList)
			{
				if (enumInstance.nameValue == name)
				{
					return enumInstance;
				}
			}
			throw new System.ArgumentException(name);
		}
	}

}